<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //95.53% 
    var reverseVowels = function(s) {
        let isVowel = {'a':1,'e':1,'i':1,'o':1,'u':1,'A':1,'E':1,'I':1,'O':1,'U':1};
        let a = s.split('');
        let i=0, j=s.length-1;
        while(i<j){
            if(isVowel[a[i]] && isVowel[a[j]]){
                [a[i], a[j]] = [a[j], a[i]];
                i++;
                j--;
            }else if(isVowel[a[i]]){
                j--;
            }else{
                i++;
            }
        }
        return a.join('');
    };
    let s = "lEetcode";
    console.log(reverseVowels(s));
    
</script>
</html>